package com.bjpowernode.util;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
 * @author admin
 */
public class LogUtils {

    public static void info(String msg, Object... args){
        print(msg, "INFO", args);
    }

    public static void error(String msg, Object... args){
        print(msg, "ERROR", args);
    }

    public static void print(String msg,String level,Object... args){
        if(args != null && args.length > 0){
            msg = String.format(msg.replace("{}", "%s"), args);
        }
        String name = Thread.currentThread().getName();
        System.out.println(LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss")) + " [" + name + "] " + level + " " + msg);
    }

}
